package com.akk.module.yb.model;

import com.akk.PayConstants;
import com.akk.module.yb.utils.Digest;

public class YbPaymentNotifyRequest {

    private String code;
    private String message;
    private String requestId;       // 订单号
    private String customerNumber;
    private String externalld;      // 收款宝交易流水
    private String createTime;      // 请求时间
    private String payTime;
    private String amount;
    private String fee;         // 手续费
    private String status;      // INIT 未支付 SUCCESS 成功 FAIL 失败 FROZEN 冻结 THAWED 解冻 REVERSE 冲正
    private String busiType;    // 交易类型
    private String bankCode;
    private String payerName;
    private String payerPhone;
    private String lastNo;
    private String src;
    private String hmac;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public String getCustomerNumber() {
        return customerNumber;
    }

    public void setCustomerNumber(String customerNumber) {
        this.customerNumber = customerNumber;
    }

    public String getExternalld() {
        return externalld;
    }

    public void setExternalld(String externalld) {
        this.externalld = externalld;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getPayTime() {
        return payTime;
    }

    public void setPayTime(String payTime) {
        this.payTime = payTime;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getFee() {
        return fee;
    }

    public void setFee(String fee) {
        this.fee = fee;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getBusiType() {
        return busiType;
    }

    public void setBusiType(String busiType) {
        this.busiType = busiType;
    }

    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    public String getPayerName() {
        return payerName;
    }

    public void setPayerName(String payerName) {
        this.payerName = payerName;
    }

    public String getPayerPhone() {
        return payerPhone;
    }

    public void setPayerPhone(String payerPhone) {
        this.payerPhone = payerPhone;
    }

    public String getSrc() {
        return src;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    public String getHmac() {
        return hmac;
    }

    public void setHmac(String hmac) {
        this.hmac = hmac;
    }

    public String getLastNo() {
        return lastNo;
    }

    public void setLastNo(String lastNo) {
        this.lastNo = lastNo;
    }

    public static String signature(YbPaymentNotifyRequest request){
        StringBuffer sb = new StringBuffer();
        sb.append(request.getCode() == null?"":request.getCode());
        sb.append(request.getMessage() == null?"":request.getMessage());
        sb.append(request.getRequestId() == null? "":request.getCustomerNumber());
        sb.append(request.getCustomerNumber() == null?"":request.getAmount());
        sb.append(request.getExternalld() == null?"":request.getExternalld());
        sb.append(request.getCreateTime() == null?"":request.getRequestId());
        sb.append(request.getPayTime() == null?"":request.getPayTime());
        sb.append(request.getAmount()== null?"":request.getAmount());
        sb.append(request.getFee() == null?"":request.getFee());
        sb.append(request.getStatus()== null?"":request.getStatus());
        sb.append(request.getBusiType() == null?"":request.getBusiType());
        sb.append(request.getBankCode() == null?"":request.getBankCode());
        sb.append(request.getPayerName() == null?"":request.getPayerName());
        sb.append(request.getPayerPhone() == null?"":request.getPayerPhone());
        sb.append(request.getLastNo() == null?"":request.getLastNo());
        sb.append(request.getSrc() == null?"":request.getSrc());
        return Digest.hmacSign(sb.toString(), PayConstants.YB_PARAMS_HMAC_KEY);
    }

}
